//
//  DPZLViewController.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/8/25.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "DPZLViewController.h"

#import "DPView.h"
#import "DPTwoView.h"
#import "DPUpdateView.h"
#import "ImageMagerViewController.h"

#import "SGQCodeViewController.h"

#import "MapSelPlaceViewController.h"
@interface DPZLViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate,UITextFieldDelegate,MapSelPlaceViewControllerDelegate>{
    NSMutableDictionary *dic;
    NSArray *arr;
    DPView *dpView;
    DPTwoView *twoView;//
    DPUpdateView *updateView;
    UIImagePickerController *imagepc;
    UIScrollView *sclView;
}
@property (nonatomic,assign)NSInteger MyTags;//图片标示
@property (nonatomic,copy)NSString *imgUrl1;
@property (nonatomic,copy)NSString *imgUrl2;
@property (nonatomic,copy)NSString *imgUrl3;
@property (nonatomic,copy)NSString *state;//标示

@end

@implementation DPZLViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self setBGColor];
    dic = [NSMutableDictionary dictionary];
    arr = @[@"",@"房产商家",@"购车商家",@"干洗商家",@"开锁商家",@"果蔬商家",@"苦力商家",@"快递商家",@"家政商家",@"洗车商家",@"上户商家"];
    [self loadNav];
    
    [self loadData];
    
}

- (void)loadNav{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, 64)];
    view.backgroundColor = [UIColor whiteColor];
    view.userInteractionEnabled = YES;
    [self.view addSubview:view];
    
    UILabel *lab = [[UILabel alloc] init];
    lab.text = @"店铺资料";
    lab.textColor = [UIColor blackColor];
    lab.font = [UIFont systemFontOfSize:18.0];
    [view addSubview:lab];
    [lab makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(view.centerX);
        make.top.equalTo(34);
    }];
    
    UILabel *line = [[UILabel alloc] init];
    line.backgroundColor = [UIColor lightGrayColor];
    [view addSubview:line];
    [line makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(0);
        make.right.equalTo(0);
        make.bottom.equalTo(view.bottom);
        make.height.equalTo(0.5);
    }];
    
    //返回按钮
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setImage:[UIImage imageNamed:@"箭头"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"箭头"] forState:UIControlStateHighlighted];
    [btn addTarget:self action:@selector(clickBack) forControlEvents:UIControlEventTouchUpInside];
    [view addSubview:btn];
    [btn makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lab.centerY);
        make.left.equalTo(5);
        make.width.equalTo(30);
        make.height.equalTo(30);
    }];
    
    //按钮
    UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
    btn2.tag = 1;
    [btn2 setTitle:@"编辑" forState:UIControlStateNormal];
    [btn2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn2 addTarget:self action:@selector(clickRight:) forControlEvents:UIControlEventTouchUpInside];
    btn2.titleLabel.font = [UIFont systemFontOfSize:15.0];
    [view addSubview:btn2];
    [btn2 makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lab.centerY);
        make.right.equalTo(-5);
        make.width.equalTo(40);
        make.height.equalTo(30);
    }];
    
}
// 返回
- (void)clickBack{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)clickRight:(UIButton *)btn{
    if (btn.tag == 1) {
//        [self loadData2];
        [self loadUI2];
        [btn setTitle:@"保存" forState:UIControlStateNormal];
        btn.tag = 2;
        dpView.hidden = YES;
        twoView.hidden = YES;
        updateView.hidden = NO;
        _state = @"标示";
    }else{
        [self loadData2];
        [self loadUI];
        [btn setTitle:@"编辑" forState:UIControlStateNormal];
        btn.tag = 1;
        dpView.hidden = NO;
        twoView.hidden = NO;
        updateView.hidden = YES;
        _state = @"";
    }
}

- (void)loadUI{
    sclView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight-64)];
    sclView.contentSize = CGSizeMake(ScreenWidth, 700);
    [self.view addSubview:sclView];
    
    //查看资料view
    dpView = [[[NSBundle mainBundle] loadNibNamed:@"DPView" owner:nil options:nil] lastObject];
    dpView.frame = CGRectMake(0, 0, ScreenWidth, 580);
    [sclView addSubview:dpView];
    
    dpView.text1.enabled = NO;
    dpView.text2.enabled = NO;
    dpView.text3.enabled = NO;
    dpView.text4.enabled = NO;
    dpView.text5.enabled = NO;
    
    [dpView.textView setEditable:NO];
    
    dpView.text1.text = [dic objectForKey:@"name"];
    dpView.text2.text = [dic objectForKey:@"legalname"];
    dpView.text3.text = [dic objectForKey:@"idcardno"];
    dpView.text4.text = [dic objectForKey:@"phone"];
    dpView.text5.text = [dic objectForKey:@"email"];
    
    _imgUrl1 = [dic objectForKey:@"idcardfront"];
    _imgUrl2 = [dic objectForKey:@"idcardreverse"];
    _imgUrl3 = [dic objectForKey:@"license"];
    
    NSString *imgUrl1 = [NSString stringWithFormat:@"%@%@",[user objectForKey:@"ImageUrl"],[dic objectForKey:@"idcardfront"]];
    NSString *imgUrl2 = [NSString stringWithFormat:@"%@%@",[user objectForKey:@"ImageUrl"],[dic objectForKey:@"idcardreverse"]];
    NSString *imgUrl3 = [NSString stringWithFormat:@"%@%@",[user objectForKey:@"ImageUrl"],[dic objectForKey:@"license"]];
    
    [dpView.image1 sd_setImageWithURL:[NSURL URLWithString:imgUrl1] placeholderImage:[UIImage imageNamed:@""]];
    [dpView.image2 sd_setImageWithURL:[NSURL URLWithString:imgUrl2] placeholderImage:[UIImage imageNamed:@""]];
    [dpView.image3 sd_setImageWithURL:[NSURL URLWithString:imgUrl3] placeholderImage:[UIImage imageNamed:@""]];
    NSString *place = [NSString stringWithFormat:@"%@%@%@%@",[dic objectForKey:@"province"],[dic objectForKey:@"city"],[dic objectForKey:@"dist"],[dic objectForKey:@"suite"]];
    dpView.labPlace.text = place;
    dpView.textView.text = [dic objectForKey:@"profile"];
//    dpView.labYQM.text = [dic objectForKey:@"invitecode"];
    
    twoView = [[[NSBundle mainBundle] loadNibNamed:@"DPTwoView" owner:nil options:nil] lastObject];
    twoView.frame = CGRectMake(0, dpView.frame.origin.y+dpView.frame.size.height, ScreenWidth, 120);
    [sclView addSubview:twoView];
    
    twoView.labYQM.text = [dic objectForKey:@"invitecode"];
    
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click2)];
    twoView.labYQM.userInteractionEnabled = YES;
    [twoView.labYQM addGestureRecognizer:tap1];
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImgMager)];
    twoView.labImgMange.userInteractionEnabled = YES;
    [twoView.labImgMange addGestureRecognizer:tap2];
    
//    dpView.labManager.userInteractionEnabled = YES;
//    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickImgMager)];
//    [dpView.labManager addGestureRecognizer:tap1];
//    
//    dpView.labYQM.userInteractionEnabled = YES;
//    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click2)];
//    [dpView.labYQM addGestureRecognizer:tap2];
    
}

- (void)clickImgMager{
    ImageMagerViewController *imgManger = [[ImageMagerViewController alloc] init];
    imgManger.merid = _merid;
    imgManger.merchanttype = _merchanttype;
    [self.navigationController pushViewController:imgManger animated:YES];
}

- (void)click2{
    SGQCodeViewController *code = [[SGQCodeViewController alloc] init];
    code.str = [dic objectForKey:@"invitecode"];
    [self.navigationController pushViewController:code animated:YES];
}

- (void)loadUI2{
    sclView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, ScreenHeight-64)];
    sclView.contentSize = CGSizeMake(ScreenWidth, 667);
    [self.view addSubview:sclView];
    
    //编辑资料view
    updateView = [[[NSBundle mainBundle] loadNibNamed:@"DPUpdateView" owner:nil options:nil] lastObject];
    updateView.text4.delegate = self;
    
    updateView.hidden = YES;
    updateView.frame = CGRectMake(0, 0, ScreenWidth, 667);
    [sclView addSubview:updateView];
    
    updateView.textView.layer.cornerRadius = 5.0;
    updateView.textView.layer.borderWidth = 1.0;
    updateView.textView.layer.borderColor = COLOR_RGB(231, 231, 231, 1).CGColor;
    
    NSString *imgUrl1 = [NSString stringWithFormat:@"%@%@",[user objectForKey:@"ImageUrl"],[dic objectForKey:@"idcardfront"]];
    NSString *imgUrl2 = [NSString stringWithFormat:@"%@%@",[user objectForKey:@"ImageUrl"],[dic objectForKey:@"idcardreverse"]];
    NSString *imgUrl3 = [NSString stringWithFormat:@"%@%@",[user objectForKey:@"ImageUrl"],[dic objectForKey:@"license"]];
    
    updateView.text1.text = [dic objectForKey:@"name"];
    updateView.text2.text = [dic objectForKey:@"legalname"];
    updateView.text3.text = [dic objectForKey:@"idcardno"];
    updateView.text4.text = [dic objectForKey:@"phone"];
    updateView.text5.text = [dic objectForKey:@"email"];
    [updateView.image1 sd_setImageWithURL:[NSURL URLWithString:imgUrl1] placeholderImage:[UIImage imageNamed:@""]];
    [updateView.image2 sd_setImageWithURL:[NSURL URLWithString:imgUrl2] placeholderImage:[UIImage imageNamed:@""]];
    [updateView.image3 sd_setImageWithURL:[NSURL URLWithString:imgUrl3] placeholderImage:[UIImage imageNamed:@""]];
    updateView.labPlace.text = [NSString stringWithFormat:@"%@%@%@",[dic objectForKey:@"province"],[dic objectForKey:@"city"],[dic objectForKey:@"dist"]];
    updateView.textDet.text = [dic objectForKey:@"suite"];
    updateView.textView.text = [dic objectForKey:@"profile"];
    
//    updateView.labdpjj.hidden = YES;
    
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click1:)];
    updateView.image1.userInteractionEnabled = YES;
    [updateView.image1 addGestureRecognizer:tap1];
    UIView *singleView1 = [tap1 view];
    singleView1.tag = 1;
    
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click1:)];
    updateView.image2.userInteractionEnabled = YES;
    [updateView.image2 addGestureRecognizer:tap2];
    UIView *singleView2 = [tap2 view];
    singleView2.tag = 2;
    
    UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click1:)];
    updateView.image3.userInteractionEnabled = YES;
    [updateView.image3 addGestureRecognizer:tap3];
    UIView *singleView3 = [tap3 view];
    singleView3.tag = 3;
    
    updateView.labPlace.userInteractionEnabled = YES;
    UITapGestureRecognizer *tap4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(click4)];
    [updateView.labPlace addGestureRecognizer:tap4];
    
}

- (void)click4{
    MapSelPlaceViewController *map = [[MapSelPlaceViewController alloc] init];
    map.delegate = self;
    [self.navigationController pushViewController:map animated:YES];
    
}
#pragma -mark MapSelPlaceViewControllerDelegate
-(void)sendLat:(NSString *)lat sendLng:(NSString *)lng{
    
}

-(void)sendAddress:(NSString *)address Det:(NSString *)det{
    updateView.textDet.text = address;
    updateView.labPlace.text = det;
}

-(void)sendText:(NSString *)text Province:(NSString *)proce City:(NSString *)city Area:(NSString *)area{
//    updateView.labPlace.text = text;
    
}

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    
    
    if ([textField.text stringByAppendingString:string].length > 11) {
        
        [LICGToast showWithText:@"电话号码不能超过11位"];
        textField.text = [textField.text substringToIndex:11];
        
        return NO;
    }
    
    return YES;
}
//选择照片
- (void)click1:(id)sender{
    UITapGestureRecognizer *tap = (UITapGestureRecognizer *)sender;
    NSInteger tags = [tap view].tag;
    _MyTags = tags;
    
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
    UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
    
    UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self pickerPicture];
    }];
    
    UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"从相册中获取" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        [self pickerPictureFromAlbum];
    }];
    
    [alert addAction:action1];
    [alert addAction:action2];
    [alert addAction:action3];
    [self presentViewController:alert animated:YES completion:nil];
    
}

//拍照获取
- (void)pickerPicture{
    if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceRear]) {
        NSLog(@"用前置摄像头");
        imagepc = [[UIImagePickerController alloc] init];
        imagepc.sourceType = UIImagePickerControllerSourceTypeCamera;
        imagepc.delegate = self;
        imagepc.allowsEditing = YES;
        imagepc.cameraDevice = UIImagePickerControllerCameraDeviceRear;
        
    }else if ([UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront]){
        NSLog(@"用后置摄像头");
        imagepc = [[UIImagePickerController alloc] init];
        imagepc.cameraDevice = UIImagePickerControllerCameraDeviceFront;
    }else{
        UIAlertController *a = [UIAlertController alertControllerWithTitle:@"调用失败" message:@"请从手机相册中选择" preferredStyle:UIAlertControllerStyleAlert];
        [self presentViewController:a animated:YES completion:nil];
    }
    
    [self presentViewController:imagepc animated:YES completion:nil];
}

//从手机的图片获取
- (void)pickerPictureFromAlbum{
    UIImagePickerController *imgpicker = [[UIImagePickerController alloc] init];
    imgpicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imgpicker.allowsEditing = YES;
    imgpicker.delegate = self;
    [self presentViewController:imgpicker animated:YES completion:nil];
    
}
#pragma -mark UIImagePickerControllerDelegate
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
    if (_MyTags == 1) {
        updateView.image1.image = [info objectForKey:UIImagePickerControllerEditedImage];
    }else if (_MyTags == 2){
        updateView.image2.image = [info objectForKey:UIImagePickerControllerEditedImage];
    }else{
        updateView.image3.image = [info objectForKey:UIImagePickerControllerEditedImage];
    }
    UIImage *img = [info objectForKey:UIImagePickerControllerEditedImage];
    //存入相册
    //UIImageWriteToSavedPhotosAlbum(imageView.image, nil, nil, nil);
    [self loadImage:img];
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    [self dismissViewControllerAnimated:YES completion:nil];
}

//上传图片
- (void)loadImage:(UIImage *)image{
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:@"pic.png" forKey:@"pic"];
    [parmas setObject:@"name" forKey:@"name"];
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    NSString *url = [NSString stringWithFormat:@"%@/App/Norm/upload",urlHead];
    [manager POST:url parameters:parmas constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
        NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        formatter.dateFormat = @"yyyy-MM-dd HH:mm:ss";
        NSString *fileName = [NSString stringWithFormat:@"%@.png",[formatter stringFromDate:[NSDate date]]];
        NSData *data = UIImageJPEGRepresentation(image, 0.5);
        [formData appendPartWithFileData:data name:@"pic" fileName:fileName mimeType:@"image/png"];
        [formData appendPartWithFileData:data name:@"name" fileName:fileName mimeType:@"image/png"];
        
    } success:^(AFHTTPRequestOperation *operation, id responseObject) {
        NSDictionary *op = [NSJSONSerialization JSONObjectWithData:responseObject options:kNilOptions error:nil];
        NSLog(@"dic:%@",op);
        NSString *error = [NSString stringWithFormat:@"%li",[[op objectForKey:@"error"] integerValue]];
        if ([error integerValue] == 200 && _MyTags == 1) {
            _imgUrl1 = [op objectForKey:@"result"];
            NSLog(@"imgUrl1:%@",_imgUrl1);
        }else if ([error integerValue] == 200 && _MyTags == 2){
            _imgUrl2 = [op objectForKey:@"result"];
            NSLog(@"imgUrl2:%@",_imgUrl2);
        }else{
            _imgUrl3 = [op objectForKey:@"result"];
            NSLog(@"imgUrl3:%@",_imgUrl3);
        }
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"error:%@",error);
    }];
    
}
//修改资料
- (void)loadData2{
    if (updateView.text1.text.length == 0) {
        [self showAlert:@"商户名称不能为空"];
        return;
    }else if (updateView.text2.text.length == 0){
        [self showAlert:@"法人姓名不能为空"];
        return;
    }else if ([self checkIdentityCardNo:updateView.text3.text] == 0){
        [self showAlert:@"身份证格式不正确"];
        return;
    }else if ([self validateMobile:updateView.text4.text] == 0){
        [self showAlert:@"手机号码不正确"];
        return;
    }else if ([self validateEmail:updateView.text5.text] == 0){
        [self showAlert:@"邮箱格式不正确"];
        return;
    }else if (updateView.textDet.text.length == 0){
        [self showAlert:@"请输入详细地址"];
        return;
    }
    
    [SVProgressHUD show];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    NSString *str = [NSString stringWithFormat:@"%@890d69e502d1d37a9e84335ccefece57",[user objectForKey:@"token2"]];
    NSString *token = [LCMD5Tool md5:str];
    
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:[user objectForKey:@"userid"] forKey:@"userid"];
    [parmas setObject:_merid forKey:@"id"];
    [parmas setObject:updateView.text1.text forKey:@"name"];
    [parmas setObject:_merchanttype forKey:@"merchanttype"];
    [parmas setObject:updateView.text2.text forKey:@"legalname"];
    [parmas setObject:updateView.text4.text forKey:@"phone"];
    [parmas setObject:[dic objectForKey:@"province"] forKey:@"province"];
    [parmas setObject:[dic objectForKey:@"city"] forKey:@"city"];
    [parmas setObject:[dic objectForKey:@"dist"] forKey:@"dist"];
    [parmas setObject:updateView.textDet.text forKey:@"suite"];
    [parmas setObject:@"106.522532" forKey:@"longitude"];
    [parmas setObject:@"29.514729" forKey:@"latitude"];
    [parmas setObject:updateView.text5.text forKey:@"email"];
    [parmas setObject:_imgUrl3 forKey:@"license"];
    [parmas setObject:_imgUrl1 forKey:@"idcardfront"];
    [parmas setObject:_imgUrl2 forKey:@"idcardreverse"];
    [parmas setObject:updateView.textView.text forKey:@"profile"];
    [parmas setObject:token forKey:@"verifiToken"];
    [parmas setObject:updateView.text3.text forKey:@"idcardno"];
    NSLog(@"parmas:%@",parmas);
    
    NSString *url = [NSString stringWithFormat:@"%@/App/Forbusiness/modifieddata",urlHead];
    [[AFHTTPSessionManager manager] POST:url parameters:parmas success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"修改申请资料res:%@",responseObject);
        NSString *error = [NSString stringWithFormat:@"%li",[[responseObject objectForKey:@"error"] integerValue]];
        if ([error integerValue] == 200) {
            [self loadData];
        }
        
        //[self loadData];
        [SVProgressHUD dismiss];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
        [SVProgressHUD dismiss];
    }];
    
}

//入驻资料详情
- (void)loadData{
    [SVProgressHUD show];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    NSString *str = [NSString stringWithFormat:@"%@890d69e502d1d37a9e84335ccefece57",[user objectForKey:@"token2"]];
    NSString *token = [LCMD5Tool md5:str];
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:[user objectForKey:@"userid"] forKey:@"userid"];
    [parmas setObject:token forKey:@"verifiToken"];
    [parmas setObject:_merid forKey:@"id"];
    NSString *url = [NSString stringWithFormat:@"%@/App/Forbusiness/shopdetails",urlHead];
    [[AFHTTPSessionManager manager] POST:url parameters:parmas success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"入驻资料res:%@",responseObject);
        NSString *error = [NSString stringWithFormat:@"%li",[[responseObject objectForKey:@"error"] integerValue]];
        if ([error integerValue] == 200 && _state.length == 0) {
            dic = [responseObject objectForKey:@"result"];
            [self loadUI];
        }
        
        [SVProgressHUD dismiss];
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
        [SVProgressHUD dismiss];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
